//package demo3;
//
//import lombok.AllArgsConstructor;
//import lombok.Data;
//import lombok.NoArgsConstructor;
//
//import java.math.BigDecimal;
//import java.math.RoundingMode;
//
//@Data
//@NoArgsConstructor
//
//public class Drink
//{
//   private String name;
//    private int weight;
//    private int value;
//    private double One_value;
//public Drink(String name,int weight,int value)
//{
//    this.name=name;
//    this.weight=weight;
//    this.value=value;
//}           实例代码块做的顺序是在new之前
////    {
////        BigDecimal bd1 =BigDecimal.valueOf(this.weight);
////        BigDecimal bd2 =BigDecimal.valueOf(this.value);
////        if(bd1!=BigDecimal.ZERO&&bd2!=BigDecimal.ZERO)
////        {
////            this.One_value=bd2.divide(bd1,2, RoundingMode.HALF_UP).doubleValue();
////        }
////        else System.out.println(this.name);
////    }
//    public void One_value()
//    {//将weight和value转换成BigDecimalL类型并去计算
//        BigDecimal bd1 =BigDecimal.valueOf(this.weight);
//        BigDecimal bd2 =BigDecimal.valueOf(this.value);
//        this.One_value=bd2.divide(bd1,2, RoundingMode.HALF_UP).doubleValue();
//    }
//}
